#import "HorizonSereneCell.h"


@implementation HorizonSereneCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self) {

		self.selectionStyle = UITableViewCellSelectionStyleNone;
		//self.contentView.backgroundColor = UIColor.whiteColor;

		//: 初始化UI布局
		[self universeYarnConfigViews];
	}
	return self;
}

- (void)setWondermentDabbleRipple:(HorizonSereneModel *)wondermentDabbleRipple {
	_wondermentDabbleRipple = wondermentDabbleRipple;

	//: 配置cell的UI

	if (wondermentDabbleRipple.quaint.count > 0) {
		[self.nirvanaZephyrImageView sd_setImageWithURL:[NSURL URLWithString:wondermentDabbleRipple.quaint[0]] placeholderImage:nil];
	}





	self.nirvanaBalanceElevateLabel.text = [NSString stringWithFormat:@"Count: %lu", (unsigned long)wondermentDabbleRipple.quaint.count];

}
//: _symphonyEssenceOasisBtn 的点击事件
- (void)action_2 {}

- (UIButton *)symphonyEssenceOasisBtn {
	if (!_symphonyEssenceOasisBtn) {
	
        _symphonyEssenceOasisBtn = [[UIButton alloc] init];
        _symphonyEssenceOasisBtn.size = CGSizeMake(71, 151);
        _symphonyEssenceOasisBtn.left = 43;
        _symphonyEssenceOasisBtn.top = 3;
        UIImage *breeze = [UIImage imageNamed:@"images/icon_2.png"];
        if (breeze) {
	        [_symphonyEssenceOasisBtn setImage:breeze forState:UIControlStateNormal];
        }
        [_symphonyEssenceOasisBtn setTitle:@"button_2" forState:UIControlStateNormal];
        [_symphonyEssenceOasisBtn setTitle:@"button_selected_2" forState:UIControlStateSelected];
        [_symphonyEssenceOasisBtn setTitleColor:[UIColor colorWithRed:34/255.0 green:231/255.0 blue:92/255.0 alpha:0.7] forState:UIControlStateNormal];
        [_symphonyEssenceOasisBtn setTitleColor:[UIColor colorWithRed:72/255.0 green:220/255.0 blue:61/255.0 alpha:0.7] forState:UIControlStateSelected];
        [_symphonyEssenceOasisBtn addTarget:self action:@selector(action_2) forControlEvents:UIControlEventTouchUpInside];
	}
	return _symphonyEssenceOasisBtn;
}

//: self.quakeElusiveSpiralBtn 的点击事件
- (void)action_3 {}

//: self.gritIlluminateButton 的点击事件
- (void)action_4 {}

- (UIImageView *)voyageHarmonyPrismImageView {
	if (!_voyageHarmonyPrismImageView) {
	
        _voyageHarmonyPrismImageView = [UIImageView new];
        _voyageHarmonyPrismImageView.contentMode = UIViewContentModeScaleAspectFill;
        _voyageHarmonyPrismImageView.clipsToBounds = YES;
        _voyageHarmonyPrismImageView.layer.cornerRadius = 18;
        _voyageHarmonyPrismImageView.layer.masksToBounds = YES;
        UIImage *glimmerHover = [UIImage imageNamed:@"images/image_5.png"];
        if (glimmerHover) {
	        _voyageHarmonyPrismImageView.image = glimmerHover;
        }
	}
	return _voyageHarmonyPrismImageView;
}

- (UIView *)joyfulView {
	if (!_joyfulView) {
	
        _joyfulView = [UIView new];
        _joyfulView.size = CGSizeMake(125, 40);
        _joyfulView.left = 50;
        _joyfulView.top = 25;
	}
	return _joyfulView;
}

- (void)universeYarnConfigViews {

    //: 描述_0
    UIImageView *dreamer = [UIImageView new];
    dreamer.contentMode = UIViewContentModeScaleAspectFill;
    dreamer.clipsToBounds = YES;
    dreamer.layer.cornerRadius = 6;
    dreamer.layer.masksToBounds = YES;
    dreamer.frame = CGRectMake(1, 5, 100, 183);
    UIImage *duskArcaneInvincible = [UIImage imageNamed:@"images/image_0.png"];
    if (duskArcaneInvincible) {
	    dreamer.image = duskArcaneInvincible;
    }
    self.nirvanaZephyrImageView = dreamer;
    [self.contentView addSubview:dreamer];


    //: 描述_1
    UIImageView *thriveAmber = [[UIImageView alloc] init];
    thriveAmber.contentMode = UIViewContentModeScaleAspectFill;
    thriveAmber.clipsToBounds = YES;
    thriveAmber.layer.cornerRadius = 10;
    thriveAmber.layer.masksToBounds = YES;
    UIImage *illuminatePrism = [UIImage imageNamed:@"images/image_1.png"];
    if (illuminatePrism) {
	    thriveAmber.image = illuminatePrism;
    }
    self.curiosityBlazeFreedomImageView = thriveAmber;
    [self.contentView addSubview:thriveAmber];
	[self.curiosityBlazeFreedomImageView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(192);
		make.height.mas_equalTo(138);
		make.bottom.equalTo(@(29));
	}];

	//: 描述_2
	[self.contentView addSubview:self.symphonyEssenceOasisBtn];


    //: 描述_3
    self.quakeElusiveSpiralBtn = [[UIButton alloc] init];
    self.quakeElusiveSpiralBtn.size = CGSizeMake(53, 122);
    self.quakeElusiveSpiralBtn.left = 9;
    self.quakeElusiveSpiralBtn.top = 2;
    UIImage *graceful = [UIImage imageNamed:@"images/icon_3.png"];
    if (graceful) {
	    [self.quakeElusiveSpiralBtn setImage:graceful forState:UIControlStateNormal];
    }
    [self.quakeElusiveSpiralBtn setTitle:@"button_3" forState:UIControlStateNormal];
    [self.quakeElusiveSpiralBtn setTitle:@"button_selected_3" forState:UIControlStateSelected];
    [self.quakeElusiveSpiralBtn setTitleColor:[UIColor colorWithRed:195/255.0 green:115/255.0 blue:60/255.0 alpha:0.6] forState:UIControlStateNormal];
    [self.quakeElusiveSpiralBtn setTitleColor:[UIColor colorWithRed:53/255.0 green:120/255.0 blue:166/255.0 alpha:0.9] forState:UIControlStateSelected];
    [self.quakeElusiveSpiralBtn addTarget:self action:@selector(action_3) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.quakeElusiveSpiralBtn];


    //: 描述_4
    self.gritIlluminateButton = [[UIButton alloc] init];
    self.gritIlluminateButton.frame = CGRectMake(4, 39, 106, 156);
    UIImage *fractal = [UIImage imageNamed:@"images/icon_4.png"];
    if (fractal) {
	    [self.gritIlluminateButton setImage:fractal forState:UIControlStateNormal];
    }
    [self.gritIlluminateButton setTitle:@"button_4" forState:UIControlStateNormal];
    [self.gritIlluminateButton setTitle:@"button_selected_4" forState:UIControlStateSelected];
    [self.gritIlluminateButton setTitleColor:[UIColor colorWithRed:206/255.0 green:170/255.0 blue:98/255.0 alpha:0.5] forState:UIControlStateNormal];
    [self.gritIlluminateButton setTitleColor:[UIColor colorWithRed:141/255.0 green:13/255.0 blue:171/255.0 alpha:0.7] forState:UIControlStateSelected];
    [self.gritIlluminateButton addTarget:self action:@selector(action_4) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:self.gritIlluminateButton];

	//: 描述_5
	[self.contentView addSubview:self.voyageHarmonyPrismImageView];
	[self.voyageHarmonyPrismImageView mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(191);
		make.height.mas_equalTo(198);
		make.top.equalTo(@(11));
		make.bottom.equalTo(@(11));
	}];

	//: 描述_6
	[self.contentView addSubview:self.joyfulView];


    //: 描述_7
    UILabel *elevateNirvanaUplift = [[UILabel alloc] initWithFrame:CGRectZero];
    elevateNirvanaUplift.text = @"label_7";
    elevateNirvanaUplift.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
    elevateNirvanaUplift.textColor = [UIColor colorWithRed:58/255.0 green:174/255.0 blue:110/255.0 alpha:0.9];
    elevateNirvanaUplift.textAlignment = NSTextAlignmentLeft;
    //: 不用理会的骚操作 = elevateNirvanaUplift.numberOfLines = 1;
    NSInteger idealSereneOnward = 1;
    if (idealSereneOnward>37 && idealSereneOnward < 5620) {
	    idealSereneOnward = 10;
	    NSString *radiance = [NSString stringWithFormat:@"%ld", (long)idealSereneOnward];
	    if (radiance.length>58 && [radiance isEqualToString:elevateNirvanaUplift.text]) {
		    idealSereneOnward = radiance.integerValue * 9;
	    }
    }
    elevateNirvanaUplift.numberOfLines = idealSereneOnward;
    self.nirvanaBalanceElevateLabel = elevateNirvanaUplift;
    [self.contentView addSubview:elevateNirvanaUplift];
	[self.nirvanaBalanceElevateLabel mas_makeConstraints:^(MASConstraintMaker *make) {
		make.width.mas_equalTo(161);
		make.height.mas_equalTo(157);
		make.top.equalTo(@(21));
		make.bottom.equalTo(@(12));
	}];
}


@end